﻿namespace MDXStudio.Tracing
{
    using Microsoft.AnalysisServices;
    using System;

    internal class TracerEvent
    {
        private readonly TraceEventArgs mEvent;

        public TracerEvent(TraceEventArgs pArgs)
        {
            this.mEvent = pArgs;
        }

        public string ApplicationName
        {
            get
            {
                return this.mEvent.get_ApplicationName();
            }
        }

        public string ClientHostName
        {
            get
            {
                return this.mEvent.get_ClientHostName();
            }
        }

        public string ClientProcessID
        {
            get
            {
                return this.mEvent.get_ClientProcessID();
            }
        }

        public string ConnectionID
        {
            get
            {
                return this.mEvent.get_ConnectionID();
            }
        }

        public long? CpuTime
        {
            get
            {
                try
                {
                    return new long?(this.mEvent.get_CpuTime());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public DateTime? CurrentTime
        {
            get
            {
                try
                {
                    return new DateTime?(this.mEvent.get_CurrentTime());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public string DatabaseName
        {
            get
            {
                return this.mEvent.get_DatabaseName();
            }
        }

        public long? Duration
        {
            get
            {
                try
                {
                    return new long?(this.mEvent.get_Duration());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public DateTime? EndTime
        {
            get
            {
                try
                {
                    return new DateTime?(this.mEvent.get_EndTime());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public string Error
        {
            get
            {
                return this.mEvent.get_Error();
            }
        }

        public TraceEventClass EventClass
        {
            get
            {
                return this.mEvent.get_EventClass();
            }
        }

        public TraceEventSubclass EventSubclass
        {
            get
            {
                return this.mEvent.get_EventSubclass();
            }
        }

        public long? IntegerData
        {
            get
            {
                try
                {
                    return new long?(this.mEvent.get_IntegerData());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public string JobID
        {
            get
            {
                return this.mEvent.get_JobID();
            }
        }

        public string NTCanonicalUserName
        {
            get
            {
                return this.mEvent.get_NTCanonicalUserName();
            }
        }

        public string NTDomainName
        {
            get
            {
                return this.mEvent.get_NTDomainName();
            }
        }

        public string NTUserName
        {
            get
            {
                return this.mEvent.get_NTUserName();
            }
        }

        public string ObjectID
        {
            get
            {
                return this.mEvent.get_ObjectID();
            }
        }

        public string ObjectName
        {
            get
            {
                return this.mEvent.get_ObjectName();
            }
        }

        public string ObjectPath
        {
            get
            {
                return this.mEvent.get_ObjectPath();
            }
        }

        public string ObjectReference
        {
            get
            {
                return this.mEvent.get_ObjectReference();
            }
        }

        public Type ObjectType
        {
            get
            {
                return this.mEvent.get_ObjectType();
            }
        }

        public long? ProgressTotal
        {
            get
            {
                try
                {
                    return new long?(this.mEvent.get_ProgressTotal());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public string RequestParameters
        {
            get
            {
                return this.mEvent.get_RequestParameters();
            }
        }

        public string RequestProperties
        {
            get
            {
                return this.mEvent.get_RequestProperties();
            }
        }

        public string ServerName
        {
            get
            {
                return this.mEvent.get_ServerName();
            }
        }

        public string SessionID
        {
            get
            {
                return this.mEvent.get_SessionID();
            }
        }

        public string SessionType
        {
            get
            {
                return this.mEvent.get_SessionType();
            }
        }

        public int? Severity
        {
            get
            {
                try
                {
                    return new int?(this.mEvent.get_Severity());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public string Spid
        {
            get
            {
                return this.mEvent.get_Spid();
            }
        }

        public DateTime? StartTime
        {
            get
            {
                try
                {
                    return new DateTime?(this.mEvent.get_StartTime());
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

        public TraceEventSuccess Success
        {
            get
            {
                return this.mEvent.get_Success();
            }
        }

        public string TextData
        {
            get
            {
                return this.mEvent.get_TextData();
            }
        }
    }
}

